package com.friends.library.servlet;

import java.io.IOException;
import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.Response;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.friends.library.Dto.Fine1;
import com.friends.library.persistence.HibernateUtil;

public class Fine extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     * @author HAVE A NICE DAY
     */
    public Fine() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String fine=request.getParameter("result");
		Session session=HibernateUtil.getSessionFactory().openSession();
		Transaction transaction=session.beginTransaction();
		Fine1 fine1=new Fine1();
		fine1.setFine(fine);
		transaction.commit();
		session.save(fine1);
		session.close();
		//response.sendRedirect("return.jsp");
	}
	
}
